package com.railway.field.controller;

import com.railway.field.entity.Rebar;
import com.railway.field.page.CountList;
import com.railway.field.service.RebarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(description = "钢筋绑扎区接口")
@RestController
@RequestMapping("Rebar")
@CrossOrigin
public class RebarController {
    @Autowired
    private RebarService rebarService;

    @ApiOperation(value = "查询钢筋绑扎区信息",notes = "传参:user_id")
    @PostMapping("/FindRebar")
    public List<Rebar> FindRebar(@RequestBody Map map){
        return rebarService.FindRebar(map);
    }

    @ApiOperation(value = "统计数据",notes = "传参:user_id")
    @PostMapping("/CountList")
    public CountList CountList(@RequestBody Map map){
        CountList countList = new CountList();
        countList.setCount_All(rebarService.CountAll(map));
        countList.setCount_Kx(rebarService.CountByState_Kx(map));
        countList.setCount_Zy(rebarService.CountByState_Zy(map));
        return countList;
    }
}
